import { createSlice } from '@reduxjs/toolkit';

const testSlice = createSlice({
    name: "test",
    initialState: {
        count: 200
    },
    reducers:{
        increment(state,action){
            state.count += action.payload;
        }
    }
});
// 将切片自动生成的action导出，生成action的名字和reducer的名字是一样的
export const {increment} = testSlice.actions;
// 将切片中的reducer导出
export default testSlice.reducer;
